<?php
/**
 * 平安充电消息模版
 */
class LaundryMsgtpl extends BaseMsgtpl
{
	/**
	 * 开始洗衣给用户发消息
	 * @param array $WechatUserInfo 微信用户信息
	 * @param array $laundryId 充电模块id
	 * @param array $value 充电时长
	 * @param array $laundryLogId 充电记录id
	 */
	public function sendMessageToUser($WechatUserInfo,$laundryId,$value,$laundryLogId)
	{
	
		$url = C('site_url')."/base/Laundry/washing/laundryId/".$laundryId.'/id/'.$laundryLogId;

		if($WechatUserInfo['wechat_id'] == 2){   //滨江后勤
			$this->wxTplSign = 'ZCnBGFQGoJUse4ZX9YPFyDfbD_fvJ2PY647Zv9kvnWE';
			$info = array(
					'first' => array("value" => '洗衣成功，请耐心等待！'),
					'keyword1' => array("value" => date("Y-m-d H:i:s")),
					'keyword2' => array("value" => date("Y-m-d H:i:s",time() + $value*60)),
					'remark' => array("value" => "详情点击查看"),
			);
		}elseif($WechatUserInfo['wechat_id'] == 5){  //农林
			$this->wxTplSign = 'I78xute7ooFPbZjNF77tcAFU7ljWS02Pg2WVF87pSFo';
			$info = array(
					'first' => array("value" => '洗衣成功，请耐心等待！'),
					'keyword1' => array("value" => date("Y-m-d H:i:s")),
					'keyword2' => array("value" => date("Y-m-d H:i:s",time() + $value*60)),
					'remark' => array("value" => "详情点击查看"),
			);
		}

		$this->wxObj->messageTpl($this->wechatInfo['appid'], $this->wechatInfo['appsecret'], $WechatUserInfo['openid'], $this->wxTplSign, $info, $url);
	}

	/**
	* 结束洗衣给用户发消息
	* @param array $WechatUserInfo 微信用户信息
	* @param array $laundryId 充电模块id
	* @param array $value 充电时长
	* @param array $laundryLogId 充电记录id
	*/
	public function sendMessageToUser2($WechatUserInfo,$logInfo,$laundryId)
	{

		$url = C('site_url')."/base/Laundry/index/laundryId/".$laundryId;
        wLog(date('Y-m-d H:i:s').'data:'.var_export($logInfo,true),'laundry2');
		if($WechatUserInfo['wechat_id'] == 2){   //滨江后勤
			$this->wxTplSign = 'ZCnBGFQGoJUse4ZX9YPFyDfbD_fvJ2PY647Zv9kvnWE';
			$info = array(
					'first' => array("value" => '你的衣服洗好啦，快去带它回来吧！'),
					'keyword1' => array("value" => date("Y-m-d H:i:s", $logInfo['start_time'])),
					'keyword2' => array("value" => date("Y-m-d H:i:s")),
					'remark' => array("value" => "详情点击查看"),
			);
		}elseif($WechatUserInfo['wechat_id'] == 5){  //农林
			$this->wxTplSign = 'I78xute7ooFPbZjNF77tcAFU7ljWS02Pg2WVF87pSFo';
			$info = array(
					'first' => array("value" => '你的衣服洗好啦，快去带它回来吧！'),
					'keyword1' => array("value" => date("Y-m-d H:i:s",$logInfo['start_time'])),
					'keyword2' => array("value" => date("Y-m-d H:i:s")),
					'remark' => array("value" => "详情点击查看"),
			);
		}

		$this->wxObj->messageTpl($this->wechatInfo['appid'], $this->wechatInfo['appsecret'], $WechatUserInfo['openid'], $this->wxTplSign, $info, $url);
	}



}
